package com.siyuanren.gcocp.enums.wx;

import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

/**
 * 课程状态
 *
 * @author guwr
 */
@Getter
public enum CourseStudyStateEnum  {
    /**
     *
     */
    COURSE_STUDY_STATE_WAIT("等待开学", 1),
    COURSE_STUDY_STATE_ING("学习中", 2),
    COURSE_STUDY_STATE_FINAL("已完成", 3);

    private String desc;
    private int value;


    CourseStudyStateEnum(String desc, int value) {
        this.desc = desc;
        this.value = value;
    }

    public static CourseStudyStateEnum getModel(int value) {
        for (CourseStudyStateEnum he : CourseStudyStateEnum.values()) {
            if (Objects.equals(value, he.getValue())) {
                return he;
            }
        }
        return null;
    }

    public static String getEnumDesc(Integer value) {
        if (value == null) {
            return StringUtils.EMPTY;
        }
        CourseStudyStateEnum model = getModel(value);
        if (model == null) {
            return StringUtils.EMPTY;
        }
        return model.getDesc();
    }
}